package com.mystudy.design_patterns.factory.factory_method;

/**
 * @program: infoalgorithm
 * @description: 八卦炉实现类
 * @author: zhouzhilong
 * @create: 2019-02-21 14:34
 **/
public class HumanFactory implements AbstractHumanFactory {
    @Override
    public <T extends Human> T createHuman(Class<T> c) {
        T human = null;
        try{
            human = c.newInstance();
//            human = (T)Class.forName(c.getName()).newInstance();
        } catch (Exception e) {
            System.out.println("生成失败");
        }
        return human;
    }
}
